#ifndef __OPENGLRENDERTARGET_H__
#define __OPENGLRENDERTARGET_H__

#include "GL/glew.h"
#include "Common.h"
#include "../RenderTarget.h"

namespace RayFrame
{
  class OpenGLTexture;

  class DLL_DECLARE OpenGLRenderTarget: public RenderTarget
  {
  protected:
    GLuint m_fboId, m_rboId;
    OpenGLTexture* m_GLTexture;
  protected:
    virtual void internalCreate();
    virtual void internalDestroy();
  public:
    OpenGLRenderTarget()
    {
      m_fboId = m_rboId = 0;
      m_GLTexture = NULL;
      m_texture = NULL;
    };

    ~OpenGLRenderTarget()
    {
      if(m_isOK)
        internalDestroy();
    };

    virtual void Create(Texture* tex);
    virtual void Begin();
    virtual void End();

    virtual void Download(Image* img);
    virtual void Download(STRING filename, ImageFileFormat iff = IFF_BMP);
  };
}

#endif /* __OPENGLRENDERTARGET_H__ */
